package com.prg.model.base;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;

/**
 * AuthGroup entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "AUTH_GROUP", schema = "SSHE")
public class AuthGroup implements java.io.Serializable {

	// Fields

	private String id;
	private String name;
	private Set<AuthPermission> authPermissions = new HashSet<AuthPermission>(0);
	private Set<AuthUser> authUsers = new HashSet<AuthUser>(0);

	// Constructors

	/** default constructor */
	public AuthGroup() {
	}

	/** full constructor */
	public AuthGroup(String name, Set<AuthPermission> authPermissions,
			Set<AuthUser> authUsers) {
		this.name = name;
		this.authPermissions = authPermissions;
		this.authUsers = authUsers;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "ID", unique = true, nullable = false, length = 100)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "NAME", length = 100)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "authGroups")
	public Set<AuthPermission> getAuthPermissions() {
		return this.authPermissions;
	}

	public void setAuthPermissions(Set<AuthPermission> authPermissions) {
		this.authPermissions = authPermissions;
	}

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "authGroups")
	public Set<AuthUser> getAuthUsers() {
		return this.authUsers;
	}

	public void setAuthUsers(Set<AuthUser> authUsers) {
		this.authUsers = authUsers;
	}

}